package com.kexio.email.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.kexio.common.entity.BaseEntity;

/**
 * 邮件模板
 * 
 * @author Kexio Team
 * @since 1.0.0
 */
@TableName("email_template")
public class EmailTemplate extends BaseEntity {
    
    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;
    
    /**
     * 模板名称
     */
    @TableField("template_name")
    private String templateName;
    
    /**
     * 模板编码
     */
    @TableField("template_code")
    private String templateCode;
    
    /**
     * 模板类型 (welcome, notification, verification, promotion, system)
     */
    @TableField("template_type")
    private String templateType;
    
    /**
     * 邮件主题模板
     */
    @TableField("subject_template")
    private String subjectTemplate;
    
    /**
     * 邮件内容模板 (HTML格式)
     */
    @TableField("content_template")
    private String contentTemplate;
    
    /**
     * 模板引擎类型 (thymeleaf, freemarker, velocity)
     */
    @TableField("engine_type")
    private String engineType;
    
    /**
     * 模板变量说明 (JSON格式)
     */
    @TableField("variables_description")
    private String variablesDescription;
    
    /**
     * 默认发件人邮箱
     */
    @TableField("default_from_email")
    private String defaultFromEmail;
    
    /**
     * 默认发件人名称
     */
    @TableField("default_from_name")
    private String defaultFromName;
    
    /**
     * 模板状态 (active, inactive)
     */
    @TableField("status")
    private String status;
    
    /**
     * 使用次数
     */
    @TableField("usage_count")
    private Long usageCount;
    
    /**
     * 预览内容 (渲染后的示例)
     */
    @TableField("preview_content")
    private String previewContent;
    
    /**
     * 排序号
     */
    @TableField("sort_order")
    private Integer sortOrder;
    
    /**
     * 样式文件路径
     */
    @TableField("style_file")
    private String styleFile;
    
    /**
     * 是否支持附件
     */
    @TableField("support_attachments")
    private Boolean supportAttachments;
    
    /**
     * 优先级 (1-5, 1最高)
     */
    @TableField("priority")
    private Integer priority;
    
    // Constructors
    public EmailTemplate() {}
    
    public EmailTemplate(String templateName, String templateCode, String templateType, 
                        String subjectTemplate, String contentTemplate, String engineType) {
        this.templateName = templateName;
        this.templateCode = templateCode;
        this.templateType = templateType;
        this.subjectTemplate = subjectTemplate;
        this.contentTemplate = contentTemplate;
        this.engineType = engineType;
        this.status = "active";
        this.usageCount = 0L;
        this.sortOrder = 0;
        this.supportAttachments = false;
        this.priority = 3;
    }
    
    // Getters and Setters
    public String getId() { return id; }
    public void setId(String id) { this.id = id; }
    
    public String getTemplateName() { return templateName; }
    public void setTemplateName(String templateName) { this.templateName = templateName; }
    
    public String getTemplateCode() { return templateCode; }
    public void setTemplateCode(String templateCode) { this.templateCode = templateCode; }
    
    public String getTemplateType() { return templateType; }
    public void setTemplateType(String templateType) { this.templateType = templateType; }
    
    public String getSubjectTemplate() { return subjectTemplate; }
    public void setSubjectTemplate(String subjectTemplate) { this.subjectTemplate = subjectTemplate; }
    
    public String getContentTemplate() { return contentTemplate; }
    public void setContentTemplate(String contentTemplate) { this.contentTemplate = contentTemplate; }
    
    public String getEngineType() { return engineType; }
    public void setEngineType(String engineType) { this.engineType = engineType; }
    
    public String getVariablesDescription() { return variablesDescription; }
    public void setVariablesDescription(String variablesDescription) { this.variablesDescription = variablesDescription; }
    
    public String getDefaultFromEmail() { return defaultFromEmail; }
    public void setDefaultFromEmail(String defaultFromEmail) { this.defaultFromEmail = defaultFromEmail; }
    
    public String getDefaultFromName() { return defaultFromName; }
    public void setDefaultFromName(String defaultFromName) { this.defaultFromName = defaultFromName; }
    
    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }
    
    public Long getUsageCount() { return usageCount; }
    public void setUsageCount(Long usageCount) { this.usageCount = usageCount; }
    
    public String getPreviewContent() { return previewContent; }
    public void setPreviewContent(String previewContent) { this.previewContent = previewContent; }
    
    public Integer getSortOrder() { return sortOrder; }
    public void setSortOrder(Integer sortOrder) { this.sortOrder = sortOrder; }
    
    public String getStyleFile() { return styleFile; }
    public void setStyleFile(String styleFile) { this.styleFile = styleFile; }
    
    public Boolean getSupportAttachments() { return supportAttachments; }
    public void setSupportAttachments(Boolean supportAttachments) { this.supportAttachments = supportAttachments; }
    
    public Integer getPriority() { return priority; }
    public void setPriority(Integer priority) { this.priority = priority; }
}
